//import Solver from "@entity/solver";
import * as fs from "fs";

export function getFile(path: string): string[] {
  return fs.readFileSync(path, "utf-8").split("\n");
}

export function outToFile(table: number[], path: string) {
  const banner = "————————————————————————————\n";
  const arrBuffer: string[] = [];
  for (let i = 0; i < 9; i++) {
    for (let j = 0; j < 9; j++) {
      arrBuffer.push(
        `${table[i * 9 + j]}` +
          (j === 2 || j === 5 ? " | " : j === 8 ? "\n" : "  ")
      );
    }
    if (i === 2 || i === 5) {
      arrBuffer.push(banner);
    }
  }
  fs.writeFileSync(path, arrBuffer.join(""));
}
